from rest_framework import serializers
from . import models

class StaffUnserializer(serializers.Serializer):
    username=serializers.CharField(max_length=32)
    password=serializers.CharField(max_length=225)
    dept_id=serializers.IntegerField()

    def create(self, validated_data):
        return models.Staff.objects.check(**validated_data)

class StaffSerializer(serializers.ModelSerializer):
    class Meta:
        model=models.Staff
        fields="__all__"


class DeptarUnserializer(serializers.Serializer):
    name=serializers.CharField(max_length=32)

    def create(self, validated_data):
        return models.Departtment.objects.check(**validated_data)


class DeptarSerializer(serializers.ModelSerializer):
    class Meta:
        model=models.Departtment
        fields="__all__"